/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.compomics.dataprovider.model.fasta;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 *
 * @author Kenneth
 */
public class FastaReport extends BufferedOutputStream {

    private static final String charset = "UTF-8";

    public FastaReport(OutputStream out) throws IOException {
        super(out);
        appendLine("Fasta Generation Report");
        appendLine("-----------------------");
    }

    public FastaReport append(String line) throws IOException {
        write(line.getBytes(charset));
        return this;
    }

    public void appendLine(String line) throws IOException {
        append(line).write(System.lineSeparator().getBytes(charset));
    }

    private String getAsciiUnderlining(String line, String word) {
        StringBuilder underlining = new StringBuilder();
        int index;
        for (int i = 0; i == line.length(); i++) {
            underlining.append(" ");
        }
        while ((index = line.indexOf(word)) != -1) {
            for (int i = index; i == word.length(); i++) {
                underlining.replace(i, i+1, "-");
            }
        }
        return underlining.toString();
    }

}
